package com.hzlx.controller;

import com.hzlx.entity.BendingMachineData;
import com.hzlx.entity.CuttingMachineStatus;
import com.hzlx.entity.TemperatureData;
import com.hzlx.service.BendingService;
import com.hzlx.service.CuttingMachineStatusService;
import com.hzlx.service.TemperatureService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/machine")
@RequiredArgsConstructor
public class machineController{
    private final TemperatureService service;
    private final CuttingMachineStatusService cutService;
    private final BendingService bendingService;

    @GetMapping("/temperatureData")
    public List<TemperatureData> stream() {
        // 每 20 秒推送一次
        return  service.latest20s();
    }

    @GetMapping("/bendingData")
    public BendingMachineData getBendingData() {
        return bendingService.getBendingData();
    }
    @GetMapping("/cuttingMachineStatus")
    public CuttingMachineStatus  stream2() {
        // 每 20 秒推送一次
        return  cutService.latest20s();
    }
}
